#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int s=0;char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s;
}
const int MAXN=2e5+3;
int sum[MAXN],v[MAXN],pre[MAXN];
signed main(){
    freopen("pockets.in","r",stdin);
    freopen("pockets.out","w",stdout);
    int N=read();
    for(int i=1;i<N;++i) v[i]=read(),sum[i]=sum[i-1]+v[i];
    int now=3;
    for(int i=4,now=3;i<N;++i){
    	if(v[i]>v[now]) pre[now]=i;
    	now=i;
	}
    int Q=read();
    while (Q--){
        v[N]=read();
        int now=0,nxt=1,cnt[2],id[2];
        id[now]=3,id[nxt]=2;
        cnt[now]=v[1];
        cnt[nxt]=v[2];
        while(id[now]<=N){
            int x=0;
            for(int i=id[now];i<=N && i!=0;i=pre[i]) if(v[i]>=sum[i-1]-sum[id[nxt]]) x=i;
            if(v[N]>=sum[N-1]-sum[id[nxt]]) x=N;
//            printf("x=%lld\n",x);
            cnt[now]+=v[x];
            cnt[nxt]+=sum[x-1]-sum[id[nxt]];
            id[now]=x;
            id[nxt]=x+1;
//            printf("%lld %lld\n",cnt[0],cnt[1]);
            swap(now,nxt);
        }
        printf("%lld\n",cnt[0]-cnt[1]);
//        now=fir;
    }
    return 0;
}
